
 /* OVERVIEW OF DO FILE for Figure 2a
We have four congresses 109-112. We will do the matching separately for each Congress and then do a pooled analysis as well. 

The DV is the average PCS score for (non)social welfare legislation. If a legislator did not introduce any social welfare legislation, then they receive a 0 as the outcome variable. 

mean_PCS0 is the average PSC score for non-social welfare legislation
mean_PCS1 is the average PCS score for social welfare legislation

*/
 


 
clear
use "LegislatorDataPCS.dta"
*log using "MeanPCS.log", replace

replace median_hh = median_hh/1000

**109th Congresses
table member_wc_pink if cong==109

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==109, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino dist_pct_union dem_vote_share    if cong==109, tr(member_wc_pink)

gen T109 =member_wc_pink 
label variable T109 "109th Congress"

eststo cong109social:reg mean_PCS1 T109 median_hh share_black party share_latino  dist_pct_union  dem_vote_share [iweight=cem_weights] if cong==109 

*estimate store cong109social

outreg2 using MeanPCS.xls, replace title("Effect of Working-Class Legislator") ///
label ctitle("109th Congress Social Welfare")

rename (cem*) (_109_cem*)


*110th Congresses
table member_wc_pink if cong==110

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share  party if cong==110, tr(member_wc_pink)

cem median_hh(#3) share_black  share_latino  dist_pct_union dem_vote_share party  if cong==110, tr(member_wc_pink)

gen T110 =member_wc_pink 
label variable T110 "110th Congress"

eststo cong110social:reg mean_PCS1 T110 median_hh share_black party share_latino   dist_pct_union dem_vote_share [iweight=cem_weights] if cong==110

*estimate store cong110social

outreg2 using MeanPCS.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("110th Congress Social Welfare ")

rename (cem*) (_110_cem*)


*111th Congresses
table member_wc_pink if cong==111

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==111, tr(member_wc_pink)

cem median_hh(#3) share_black  share_latino  dist_pct_union dem_vote_share party if cong==111, tr(member_wc_pink)

gen T111 =member_wc_pink 
label variable T111 "111th Congress"

eststo cong111social:reg mean_PCS1 T111 median_hh share_black party share_latino  dist_pct_union  dem_vote_share [iweight=cem_weights] if cong==111

*estimate store cong111social

outreg2 using MeanPCS.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("111th Congress Social Welfare ")
rename (cem*) (_111_cem*)



*112th Congresses
table member_wc_pink if cong==112

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==112, tr(member_wc_pink)

cem median_hh(#3) share_black  share_latino  dist_pct_union dem_vote_share party if cong==112, tr(member_wc_pink)

gen T112 =member_wc_pink 
label variable T112 "112th Congress"

eststo cong112social:reg mean_PCS1 T112 median_hh share_black party share_latino  dist_pct_union  dem_vote_share [iweight=cem_weights] if cong==112
*estimate store cong112social

outreg2 using MeanPCS.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("112th Congress Social Welfare ")

rename (cem*) (_112_cem*)


**All Congresses 
quietly tabulate cong, generate(new_congress)
table member_wc_pink

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share cong party, tr(member_wc_pink)

cem median_hh(#3) share_black  share_latino  dist_pct_union dem_vote_share cong party, tr(member_wc_pink)

gen Tall =member_wc_pink 
label variable Tall "All Congresses"

eststo AllCongSocial:reg mean_PCS1 Tall median_hh share_black party share_latino  dist_pct_union  dem_vote_share i.cong [iweight=cem_weights] 
*estimate store AllCongSocial

outreg2 using MeanPCS.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("All Congresses Social Welfare ")


rename (cem*) (_AllCong_cem*)

label variable T109 `""109th Congress" "2005-07""'
label variable T110 `""110th Congress" "2007-09""'
label variable T111 `""111th Congress" "2009-11""'
label variable T112 `""112th Congress" "2011-13""' 
label variable Tall `""All Congresses" "2007-13""' 


**Plot of Working Class Background on Mean PCS Scores
	coefplot ///
    (cong109social,  label("109") msymbol(O) mcolor(black) ) ///
    (cong110social, label("110") msymbol(O) mcolor(black) ) ///
    (cong111social, label("111") msymbol(O) mcolor(black)) ///
    (cong112social, label("112") msymbol(O) mcolor(black)) ///
    (AllCongSocial, label("All") msymbol(O) mcolor(black) ), ///
    keep (T109 T110 T111 T112 Tall) ///
    scheme(s1mono) ///
    xline(0) ///
    level(90) ///
    legend(off) ///
	 ciopts(recast(rcap) lcolor(black)) ///
	 offset (0) ///
    xtitle(Average PCS Score)
	
	graph save Figure2a.gph, replace
	
log close

*--------------------------------------------------------------------------------------------



 /* OVERVIEW OF DO FILE
We have four congresses 109-112. We will do the matching separately for each Congress and then do a pooled analysis as well. 

These analyses use the Maximum value of the pink measure of working class for each legislator and the Clausen measure of Social Welfare legislation
The Intro Clausen variable is coded 1 if a Legislator introduced a bill coded as social welfare legislation in a given congress. 

*/
 
clear

use "LegislatorDataPCS.dta"
*log using "MaxPCS.log", replace
replace median_hh=median_hh/1000


**we have four congresses 109-112. We will do the matching separately for each Congress and then do a pooled analysis as well. 

**109th Congresses
table member_wc_pink if cong==109

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==109, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party   if cong==109, tr(member_wc_pink)

gen T109 =member_wc_pink 
label variable T109 "109th Congress"

eststo cong109social:reg max_PCS1 T109 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==109 

outreg2 using MaxPCS.xls, replace title("Effect of Working-Class Legislator") ///
label ctitle("109th Congress Social Welfare")

rename (cem*) (_109_cem*)


*110th Congresses
table member_wc_pink if cong==110

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share  party if cong==110, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party  if cong==110, tr(member_wc_pink)

gen T110 =member_wc_pink 
label variable T110 "110th Congress"

eststo cong110social:reg max_PCS1 T110 median_hh share_black party share_latino party  dist_pct_union dem_vote_share [iweight=cem_weights] if cong==110

*estimate store cong110social

outreg2 using MaxPCS.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("110th Congress Social Welfare ")

rename (cem*) (_110_cem*)


*111th Congresses
table member_wc_pink if cong==111

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==111, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==111, tr(member_wc_pink)

gen T111 =member_wc_pink 
label variable T111 "111th Congress"
eststo cong111social:reg max_PCS1 T111 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==111

*estimate store cong111social

outreg2 using MaxPCS.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("111th Congress Social Welfare ")

rename (cem*) (_111_cem*)

*112th Congresses
table member_wc_pink if cong==112

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==112, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==112, tr(member_wc_pink)

gen T112 =member_wc_pink 
label variable T112 "112th Congress"

eststo cong112social:reg max_PCS1 T112 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==112
*estimate store cong112social

outreg2 using MaxPCS.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("112th Congress Social Welfare ")

rename (cem*) (_112_cem*)


**All Congresses 
quietly tabulate cong, generate(new_congress)
table member_wc_pink

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share cong party, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share cong party, tr(member_wc_pink)

gen Tall =member_wc_pink 
label variable Tall "All Congresses"

eststo AllCongSocial:reg max_PCS1 Tall median_hh share_black party share_latino  dist_pct_union party dem_vote_share i.cong [iweight=cem_weights] 
*estimate store AllCongSocial

outreg2 using MaxPCS.xls, append title("Effect of Working-Class Legislator") ///
label ctitle("All Congresses Social Welfare ")

rename (cem*) (_AllCong_cem*)

**Plot of Working Class Background on Max PCS Scores
	coefplot ///
    (cong109social,  label("109") msymbol(O) mcolor(black) ) ///
    (cong110social, label("110") msymbol(O) mcolor(black) ) ///
    (cong111social, label("111") msymbol(O) mcolor(black)) ///
    (cong112social, label("112") msymbol(O) mcolor(black)) ///
    (AllCongSocial, label("All") msymbol(O) mcolor(black) ), ///
    keep (T109 T110 T111 T112 Tall) ///
    scheme(s1mono) ///
    xline(0) ///
    level(90) ///
    legend(off) ///
	ylabel(none) ///
	 ciopts(recast(rcap) lcolor(black)) ///
	 offset(0) ///
    xtitle(Maximum PCS Score)
	
	graph save Figure2b.gph, replace
	
*log close

*----------------------------------------------------------------------------------------
*ensure that both Figures 2a and 2b are in the same folder and that is the working directory


**Figure 2
graph combine ///
Figure2a.gph ///
Figure2b.gph , ///
cols(2) /// 
note (90% Confidence Intervals)

